package com.example.administrator.myapplication;

import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";
    Button mBtnNext;
    Button mBtnDialog;
    Button mBtnSelf;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mBtnNext=findViewById(R.id.btn_next);
        mBtnDialog=findViewById(R.id.btn_dialog);
        mBtnSelf=findViewById(R.id.btn_self);
        mBtnSelf.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        mBtnDialog.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AlertDialog.Builder builder= new AlertDialog.Builder(MainActivity.this);

                builder.setTitle("消息");
                builder.setMessage("对话框，是一个用户交互的工具");
                AlertDialog alertDialog=builder.create();
            }
        });
        mBtnNext .setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,Main2Activity.class);
                startActivity(intent);
            }
        });
        Log.e(TAG, "onCreate: ");
    }
     protected void onStart(){
        super.onStart();
         Log.e(TAG, "onStart: ");

     }
     protected void onResume(){
         super.onResume();
         Log.e(TAG, "onResume: " );
     }
     protected void onPause(){
         super.onPause();
         Log.e(TAG, "onPause: " );
     }
     protected void onStop(){
         super.onStop();
         Log.e(TAG, "onStop: " );
     }
     protected void onDestroy(){
         super.onDestroy();
         Log.e(TAG, "onDestroy: " );
     }
     protected void onRestart(){
         super.onRestart();
         Log.e(TAG, "onRestart: " );
     }
}
